import xlwt

book = xlwt.Workbook()
sheet = book.add_sheet('xiangxin')
# sheet.write(0,0,'name')  #行,列,内容
# sheet.write(0,1,'age')
# sheet.write(0,2,'high')
# sheet.write(1,0,'cuixuetao')
# sheet.write(1,1,'28')
# sheet.write(1,2,'182cm')
# book.save('xlwt.xls')

title = ['姓名', '班级', '住址', '手机号']

shuzu = [
    ['bred', 'class1', 'mingdong', 188109],
    ['shade', 'class2', 'gugong', 3332],
    ['dd', 'class3', 'changcheng', 6666]
]
# 写入表头
i = 0
for j in title:
    sheet.write(0, i, j)
    i += 1
#写入表内容
l = 1
for d in shuzu:
    c = 0
    for dd in d:
        sheet.write(l, c, dd)
        c+=1
    l+=1
#保存
book.save('嵌套循环.xls')